#include "Blocks/GravestoneBlock.h"

namespace PocketSurvival
{
    void GravestoneBlock::getCreativeValues(std::vector<int32_t> &blockVec)
    {
        for(int32_t index = 0; index < 8; ++index)
        {
            int32_t data = SetVariant(0, index);
            blockVec.push_back(Terrain::MakeBlockValue(Index(), 0, data));
        }
    }

    void GravestoneBlock::getDropValues(int32_t oldValue, int32_t newValue, int32_t toolLevel, std::vector<BlockDropValue> &dropValues)
    {
		dropValues.push_back(BlockDropValue{ Terrain::MakeBlockValue(Index(), 0, Terrain::ExtractData(oldValue)), 1 });
    }

    BlockPlacementData GravestoneBlock::getPlacementValue(ComponentMiner *componentMiner, int32_t value, const TerrainRaycastResult &raycastResult)
    {
		BlockPlacementData result;
		result.value = 0;
		result.cellFace = raycastResult.cellFace;
		return result;
    }

    const std::vector<BoundingBox> &GravestoneBlock::getCustomCollisionBoxes(int32_t value)
    {
        int32_t num = Terrain::ExtractData(value);
        if(num < GET_ARRAY_LEN(BlockConstans::gravestoneCollisionBoxes))
        {
            return BlockConstans::gravestoneCollisionBoxes[num];
        }
        return BlockConstans::zeroCollisionBoxes;
    }

    int32_t GravestoneBlock::getIndex()
    {
        return Index();
    }
    const std::string &GravestoneBlock::getBlockName()
    {
        static std::string blockName = "GravestoneBlock";
        return blockName;
    }
	
} // namespace PocketSurvival
